/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entity;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author HP
 */
@Entity
@Table(name = "orders", catalog = "Asm", schema = "dbo")
@NamedQueries({
    @NamedQuery(name = "Orders.findAll", query = "SELECT o FROM Orders o"),
    @NamedQuery(name = "Orders.findById", query = "SELECT o FROM Orders o WHERE o.id = :id"),
    @NamedQuery(name = "Orders.findByTotalAmount", query = "SELECT o FROM Orders o WHERE o.totalAmount = :totalAmount"),
    @NamedQuery(name = "Orders.findByOrdersDate", query = "SELECT o FROM Orders o WHERE o.ordersDate = :ordersDate"),
    @NamedQuery(name = "Orders.findByIsEnable", query = "SELECT o FROM Orders o WHERE o.isEnable = :isEnable"),
    @NamedQuery(name = "Orders.findByIsCompleted", query = "SELECT o FROM Orders o WHERE o.isCompleted = :isCompleted"),
    @NamedQuery(name = "Orders.findByIsTransported", query = "SELECT o FROM Orders o WHERE o.isTransported = :isTransported")})
public class Orders implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id", nullable = false)
    private Integer id;
    @Basic(optional = false)
    @Column(name = "totalAmount", nullable = false, precision = 19, scale = 4)
    private BigDecimal totalAmount;
    @Basic(optional = false)
    @Column(name = "ordersDate", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date ordersDate;
    @Basic(optional = false)
    @Column(name = "isEnable", nullable = false)
    private boolean isEnable;
    @Basic(optional = false)
    @Column(name = "isCompleted", nullable = false)
    private boolean isCompleted;
    @Basic(optional = false)
    @Column(name = "isTransported", nullable = false)
    private boolean isTransported;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "orders")
    private List<OrdersDetails> ordersDetailsList;

    public Orders() {
    }

    public Orders(Integer id) {
        this.id = id;
    }

    public Orders(Integer id, BigDecimal totalAmount, Date ordersDate, boolean isEnable, boolean isCompleted, boolean isTransported) {
        this.id = id;
        this.totalAmount = totalAmount;
        this.ordersDate = ordersDate;
        this.isEnable = isEnable;
        this.isCompleted = isCompleted;
        this.isTransported = isTransported;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public BigDecimal getTotalAmount() {
        return totalAmount;
    }

    public void setTotalAmount(BigDecimal totalAmount) {
        this.totalAmount = totalAmount;
    }

    public Date getOrdersDate() {
        return ordersDate;
    }

    public void setOrdersDate(Date ordersDate) {
        this.ordersDate = ordersDate;
    }

    public boolean getIsEnable() {
        return isEnable;
    }

    public void setIsEnable(boolean isEnable) {
        this.isEnable = isEnable;
    }

    public boolean getIsCompleted() {
        return isCompleted;
    }

    public void setIsCompleted(boolean isCompleted) {
        this.isCompleted = isCompleted;
    }

    public boolean getIsTransported() {
        return isTransported;
    }

    public void setIsTransported(boolean isTransported) {
        this.isTransported = isTransported;
    }

    public List<OrdersDetails> getOrdersDetailsList() {
        return ordersDetailsList;
    }

    public void setOrdersDetailsList(List<OrdersDetails> ordersDetailsList) {
        this.ordersDetailsList = ordersDetailsList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Orders)) {
            return false;
        }
        Orders other = (Orders) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Orders[id=" + id + "]";
    }

}
